//用户接口
import request from '@/utils/request'
//统一管理接口
enum API {
  ADDGOODS_URL = '/goods/addgoodsinfo',
  GETGOODS_URL = '/goods/getgoodsinfo',
  DELETEGOODS_URL = '/goods/deletegoodsinfo',
  UPDATEGOODS_URL = '/goods/updategoodsinfo',
}
//增加商品
export const addgoods = (params: any) =>
  request.post<any, any>(API.ADDGOODS_URL, params, {
    headers: { 'Content-Type': 'multipart/form-data' },
  })
//获取商品列表
export const paginatedGoodsinfolist = (
  page: number,
  limit: number,
  inputGoods: string,
) =>
  request.get<any, any>(
    `${API.GETGOODS_URL}?page=${page}&limit=${limit}&q=${inputGoods}`,
  )

//删除商品
export const deletegoods = (id: any) =>
  request.delete<any, any>(`${API.DELETEGOODS_URL}?${id}`)

//编辑商品
export const updategoods = (params: any) =>
  request.post<any, any>(API.UPDATEGOODS_URL, params, {
    headers: { 'Content-Type': 'multipart/form-data' },
  })
